package com.keepmoving.web;

import com.keepmoving.po.Coach;
import com.keepmoving.service.CoachInfoService;
import com.keepmoving.service.CoachService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author xf
 * 教练控制器
 */
@Controller
public class CoachController {

    //      创建日志对象
    Logger logger = Logger.getLogger(CoachController.class);

    @Resource
    CoachService coachService;

    @Resource
    CoachInfoService coachInfoService;

    @RequestMapping("/coachtoshow")
    public String coachToShow(int coId, Model model, HttpSession session) {
        logger.info("展示教练信息");
        List<Coach> list = coachInfoService.findByIdInfo(coId);
        logger.info(list);
        session.setAttribute("coId",coId);
        model.addAttribute("list", list);
        return "coachshow";
    }



}
